" -------------------------
" rhysd/vim-clang-format
" ------------------------" 
let g:clang_format#style_options = {
            \ "AccessModifierOffset" : -4,
            \ "AllowShortIfStatementsOnASingleLine" : "true",
            \ "AlwaysBreakTemplateDeclarations" : "true",
            \ "Standard" : "C++11",
            \ "AlignConsecutiveDeclarations" : "true",
            \ "DerivePointerAlignment" : "false",
            \ "PointerAlignment" : "true",
            \ "BreakBeforeBraces" : "Custom",
            \ "BraceWrapping" : 
            \   {"AfterClass" : "true",
            \   "AfterEnum" : "true",
            \   "AfterStruct" : "true",
            \   "AfterUnion" : "true",
            \   "AfterControlStatement" : "true",
            \   "AfterFunction" : "true",
            \   "BeforeElse" : "true",
            \   "BeforeCatch" : "true"}}

" map to <Leader>cf in C++ code
autocmd FileType c,cpp,objc nnoremap <buffer><Leader>cf :<C-u>ClangFormat<CR>
autocmd FileType c,cpp,objc vnoremap <buffer><Leader>cf :ClangFormat<CR>
" Auto-enabling auto formatting:
auto FileType c ClangFormatAutoEnable
